package com.xiu.travel.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

/**
 * @author 2023
 */

@AllArgsConstructor
public enum DaDaCallbackStatusEnum implements IEnum
{

    /**
     * 待接单
     */
    WAIT_ACCEPT(1, "待骑手接单"),
    /**
     * 待取货
     */
    WAIT_PICKUP(2, "骑手正在赶往商家"),
    /**
     * 配送中
     */
    DELIVERING(3, "骑手正在配送"),
    /**
     * 已完成
     */
    COMPLETED(4, "已完成"),
    /**
     * 已取消
     */
    CANCELED(5, "已取消"),
    /**
     * 已追加待接单
     */
    WAIT_ACCEPT_ADDED(8, "已追加待接单"),
    /**
     * 妥投异常之物品返回中
     */
    RETURNING(9, "妥投异常之物品返回中"),
    /**
     * 妥投异常之物品返回完成
     */
    RETURNED(10, "妥投异常之物品返回完成"),
    /**
     * 骑士到店
     */
    COURIER_AT_STORE(100, "骑士到店"),
    /**
     * 创建达达运单失败
     */
    DADA_CREATE_ORDER_FAILED(1000, "创建达达运单失败");

    @EnumValue
    private final Integer code;
    @JsonValue
    private final String status;

    public int getCode()
    {
        return code;
    }

    public String getStatus()
    {
        return status;
    }

    @Override
    public Integer getValue()
    {
        return code;
    }

    public static DaDaCallbackStatusEnum getEnumByCode (Integer code){
        for (DaDaCallbackStatusEnum daCallbackStatusEnum : DaDaCallbackStatusEnum.values())
        {
            if (daCallbackStatusEnum.getValue().equals(code))
            {
                return daCallbackStatusEnum;
            }
        }
        return null;
    }
}

